#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.db.models import Sum
from rest_framework import serializers

from .models import VehicleInfoModel, VehicleFenceModel, VehicleMoveInfoModel, VehicleFaultInfoModel, \
    VehicleFaultLogModel

from application.settings import redis_cli
from dvadmin.utils.serializers import CustomModelSerializer


class VehicleInfoModelSerializer(CustomModelSerializer):
    """
    序列化器
    """

    class Meta:
        model = VehicleInfoModel
        fields = "__all__"


class VehicleFenceModelSerializer(CustomModelSerializer):
    """
    序列化器
    """

    class Meta:
        model = VehicleFenceModel
        fields = "__all__"


class VehicleMoveModelSerializer(CustomModelSerializer):
    """
    序列化器
    """

    class Meta:
        model = VehicleMoveInfoModel
        fields = ["vehicle_vin", "start_time", "end_time", "score", "offset"]

class VehicleFaultModelSerializer(CustomModelSerializer):
    """
    序列化器
    """

    class Meta:
        model = VehicleFaultInfoModel
        fields = "__all__"


class VehicleFaultLogModelSerializer(CustomModelSerializer):
    """
    序列化器
    """

    class Meta:
        model = VehicleFaultLogModel
        fields = "__all__"
